package com.interview.config;
import com.netflix.loadbalancer.*;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.lang.ref.SoftReference;

@Configuration
public class RestConfig {

    @Bean
    @LoadBalanced //加入负载均衡注解
    public RestTemplate restTemplate(){
        //httpclinet
        return new RestTemplate();
    }

//    @Bean
//    public IRule iRule(){
//        //轮询调度
//        return new RoundRobinRule();
//        //随机调度
//        //RandomRule randomRule = new RandomRule();
//        //new RetryRule();
//        //return randomRule;
//    }
}
